#include <stdio.h>

int main(void)
{
    int num, demo, a, b, c = 1;

    printf("Enter a fraction: ");
    scanf("%d/%d", &num, &demo);

    a = num;
    b = demo;

    while (b != 0)
    {
        c = a % b;
        a = b;
        b = c;
    }

    printf("In lowest terms: %d/%d", num / a, demo / a);

    return 0;
}